package com.lvt.example.thinking.in.spring.questions.L21.aop.example01;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * desc：class
 *
 * @author LT
 * @date 2022/10/24
 */
@Slf4j
@Aspect
@Component
public class ChargeAop {

    @Around("execution(* com.lvt.example.thinking.in.spring.questions.L21.aop.example01.ElectricService.pay())")
    public void recordPayPerformance(ProceedingJoinPoint joinPoint) throws Throwable {
        long start = System.currentTimeMillis();
        joinPoint.proceed();
        long end = System.currentTimeMillis();
        log.info("pay spend time is:{}", end - start);
    }
}
